from typing import *


class Solution:

    def averageValue(self, nums: List[int]) -> int:
        cnt = sum = 0
        for num in nums:
            if num % 3 == 0 and num % 2 == 0:
                cnt += 1
                sum += num
        return 0 if cnt == 0 else sum // cnt